package com.example.proramqdemo.ramq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/*********************************************************
 * @Author ONE_LLX
 * @Description //TODO 
 * @Date 17:41 2019/11/24
 * @Class ProduerTest
 * @Version v1.0
 *********************************************************/
@Component
public class ProduerTest {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(){
        for (int i=0;i<10;i++){
            String msg="hello 序号"+i;
            System.out.println(msg);
            rabbitTemplate.convertAndSend("rabbit-test1",msg);
        }
    }
}
